/**
 * @param {string} start
 * @param {string} end
 * @return {boolean}
 */
 var canTransform = function(start, end) {
   if(start.length!=end.length) return false
    let temp = ''
    for(let i=0;i<start.length;){
      if(start[i]=='R' && start[i+1] && start[i+1]=='X'){
        temp+='XR'
        i+=2
      }
      else if(start[i]=='X' && start[i+1] && start[i+1]=='L'){
        temp+='LX'
        i+=2
      }
      else{
        i++
        temp+=start[i]?start[i]:''
      }
    }
    console.log(temp+'--'+end);
    if(temp==end) return true
    else return false
};


console.log(canTransform("RXXLRXRXL","XRLXXRRLX"));
